package com.cfwx.db.jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class StudentJbbcTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
	Connection conn = JdbcUtil.getConnection();
	try {
		Statement sts = conn.createStatement();
		String sql ="select * from student";
		ResultSet res = sts.executeQuery(sql);
		while(res.next()){
			
			System.out.print(res.getString("SID")+" ");
			System.out.print(res.getString("SNAME")+" ");
			System.out.println(res.getString("AGE")+" ");
		}
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	finally{
		JdbcUtil.closeConnection(conn);
	}
	
	}

}
